package com.wendy.web.editor;

import com.wendy.utils.Constants;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.propertyeditors.PropertiesEditor;

/**
 * @author zhuwending
 */
public class XssEditor extends PropertiesEditor {

    @Override
    public String getAsText() {
        Object v = this.getValue();
        return v == null ? null : v.toString();
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (StringUtils.isNotBlank(text) && !Constants.NULL.equalsIgnoreCase(text)) {
            this.setValue(text);
        }
    }
}
